# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=solarus-quest-editor
pkgver=1.7.0
_commit_ver=c6861dead576c5ed18dfdd33a8082101683c0324
pkgrel=0
pkgdesc="Game editor for the Solarus engine."
url="https://www.solarus-games.org/"
#ppc64le, riscv64, loongarch64: # no luajit found
#aarch64, armhf, armv7: OpenGL/ES3 error while compiling
arch="all !aarch64 !armhf !armv7 !ppc64le !riscv64 !loongarch64"
license="GPL-3.0-Only"
depends="solarus-engine"
makedepends="
	cmake
	glm-dev
	libvorbis-dev
	libmodplug-dev
	luajit-dev
	mesa-dev
	openal-soft-dev
	physfs-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	samurai
	sdl2-dev
	sdl2_image-dev
	sdl2_ttf-dev
	"
source="$pkgname-$pkgver.tar.gz::https://gitlab.com/solarus-games/solarus-quest-editor/-/archive/$_commit_ver/solarus-quest-editor-$_commit_ver.tar.gz"

builddir="$srcdir/$pkgname-$_commit_ver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1dd74d3eda525abc9384faeaad3c3f298753b51e40f231425af8bd544e85b6dc497d7cedcdb9989a497a7dd5717b028a8a3454121520809139ea87e5bd2e28fa  solarus-quest-editor-1.7.0.tar.gz
"
